{% set pypi_name = 'neutron-lib' %}
{% set upstream_version = upstream_version('2.8.0') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        OpenStack Neutron library
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/neutron-lib/latest/
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('SQLAlchemy') }}
BuildRequires:  {{ py3('WebOb') }}
BuildRequires:  {{ py3('debtcollector') }}
BuildRequires:  {{ py3('fixtures') }}
BuildRequires:  {{ py3('keystoneauth1') }}
BuildRequires:  {{ py3('os-api-ref') }}
BuildRequires:  {{ py3('os-ken') }}
BuildRequires:  {{ py3('os-traits') }}
BuildRequires:  {{ py3('oslo.concurrency') }}
BuildRequires:  {{ py3('oslo.config') }}
BuildRequires:  {{ py3('oslo.context') }}
BuildRequires:  {{ py3('oslo.db') }}
BuildRequires:  {{ py3('oslo.i18n') }}
BuildRequires:  {{ py3('oslo.log') }}
BuildRequires:  {{ py3('oslo.messaging') }}
BuildRequires:  {{ py3('oslo.policy') }}
BuildRequires:  {{ py3('oslo.service') }}
BuildRequires:  {{ py3('oslo.utils') }}
BuildRequires:  {{ py3('oslo.versionedobjects') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('osprofiler') }}
BuildRequires:  {{ py3('pbr') }}
BuildRequires:  {{ py3('pecan') }}
BuildRequires:  {{ py3('python-subunit') }}
BuildRequires:  {{ py3('setproctitle') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('testresources') }}
BuildRequires:  {{ py3('testscenarios') }}
BuildRequires:  {{ py3('testtools') }}
BuildArch:      noarch

%description
OpenStack Neutron library shared by all Neutron sub-projects.

%package -n {{ py2name(py_versions='py3') }}
Summary:        OpenStack Neutron library
Requires:       {{ py3('SQLAlchemy') }}
Requires:       {{ py3('WebOb') }}
Requires:       {{ py3('keystoneauth1') }}
Requires:       {{ py3('os-ken') }}
Requires:       {{ py3('os-traits') }}
Requires:       {{ py3('oslo.concurrency') }}
Requires:       {{ py3('oslo.config') }}
Requires:       {{ py3('oslo.context') }}
Requires:       {{ py3('oslo.db') }}
Requires:       {{ py3('oslo.i18n') }}
Requires:       {{ py3('oslo.log') }}
Requires:       {{ py3('oslo.messaging') }}
Requires:       {{ py3('oslo.policy') }}
Requires:       {{ py3('oslo.serialization') }}
Requires:       {{ py3('oslo.service') }}
Requires:       {{ py3('oslo.utils') }}
Requires:       {{ py3('oslo.versionedobjects') }}
Requires:       {{ py3('osprofiler') }}
Requires:       {{ py3('pecan') }}
Requires:       {{ py3('setproctitle') }}
Requires:       {{ py3('six') }}
Requires:       {{ py3('stevedore') }}

%description -n {{ py2name(py_versions='py3') }}
OpenStack Neutron library shared by all Neutron sub-projects.

This package contains the Python 3.x module.

%package -n python-neutron-lib-doc
Summary:        OpenStack Neutron library documentation
Group:          Documentation/HTML
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}
BuildRequires:  {{ py3('reno') }}

%description -n python-neutron-lib-doc
OpenStack Neutron library shared by all Neutron sub-projects.

%prep
%autosetup -n neutron-lib-%{version}
%py_req_cleanup

%build
%{py3_build}

%install
%{py3_install}

# Build HTML docs and man page
PBR_VERSION=%{version} %sphinx_build -b html doc/source doc/build/html
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}

%check
# we don't want to depend on hacking
rm -rf neutron_lib/tests/unit/hacking
python3 -m stestr.cli run

%files -n {{ py2name(py_versions='py3') }}
%license LICENSE
%doc README.rst
%{python3_sitelib}/neutron_lib
%{python3_sitelib}/neutron_lib*egg-info

%files -n python-neutron-lib-doc
%doc doc/build/html
%license LICENSE

%changelog
